package com.example.klaraservice.utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @author : Glacialerisa
 * @date : 2023/6/7 14:35
 * @desc : 获取url后面的参数
 */
public class UrlUtil {
    /**
     *    String url = "http://localhost:8888/api/files/download/6bfbad3cb7fd4b69810348ba8aa14ba7";
     */
    public static final String IP = "http://172.17.33.23:8888/api/files/download/";
    private static final String PATTERN = "/([A-Za-z0-9]+)$";
    public static String getUrl(String url){
        Pattern p = Pattern.compile(PATTERN);
        Matcher matcher = p.matcher(url);
        if (matcher.find()) {
            String newUrl = matcher.group(1);
//            System.out.println(newUrl); // 输出 6bfbad3cb7fd4b69810348ba8aa14ba7
            return newUrl;
        }
        return null;
    }
}
